home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1997 #1
/
Amiga Plus CD - 1997 - No. 01.iso
/
pd
/
sonstiges
/
spontimag10
/
owindow.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-14
|
2KB
|
108 lines
/****** OWindow.h ***********************************************
*
* PROGRAM
* OWindow
*
* CONTENTS
* C++-class definitions for creating a simple window, and parsing messages.
*
* AUTHOR
* Georg Pfundt
*
* COPYRIGHT
* © by Georg Pfundt 14-OCT-1996
*
* LANGUAGE
* ANSI-C
*
* TRANSLATOR
* SAS-C V6.55
*
* HISTORY
* 1.0, GeP, 14-OCT-1996, first version
* <Version, Autor, Datum, Bemerkung>
*
* SUPPORT
* None.
*
* IMPORTS
* None.
*
* BUGS
* None known.
*
* ADDRESS
* Georg Pfundt, Im Oberviertel 18, 76229 Karlsruhe, Germany
*
* PHONE
* +49 (0)721/481591
* E-Mail: gp@ict.fhg.de
*
* UPDATE
*
********************************************************************
* TABSIZE=2
*/
#include <exec/types.h>
#include <proto/Exec.h>
#include <proto/Graphics.h>
#include <proto/Intuition.h>
/* External libbases for autoinitialisation */
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase *GfxBase;
// Define Class for creating a window
class OWindow
{
public:
// Constructor
OWindow(const char *name, const ULONG width, const ULONG height,
const ULONG xofs=0L, const ULONG yofs=0L);
// Destructor
virtual ~OWindow(void);
// Check for good initialisation
inline BOOL IsOK(void) {return this->window != NULL;};
// Pointer to window rastport for drawing
struct RastPort *RP;
// Event types that are parsed and returned.
enum OW_Event_T {OW_None, OW_Close};
typedef OW_Event_T OW_Event;
// Check for new Message, remove it from queue, parse and reply
OW_Event CheckMessage(void);
// Wait for new Message, remove it from queue, parse and reply
OW_Event WaitMessage(void);
// Get Inner dimensions of Window (usable dimensions)
inline ULONG GetInnerWidth(void) {
return (LONG)(window->Width) - (LONG)(window->BorderLeft)
- (LONG)(window->BorderRight);}
inline ULONG GetInnerHeight(void) {
return (LONG)(window->Height) - (LONG)(window->BorderTop)
- (LONG)(window->BorderBottom);}
// Get Drawing offset
inline WORD GetLeftOffset(void) {return window->BorderLeft;}
inline WORD GetTopOffset(void) {return window->BorderTop;}
private:
// Pointer to Window
struct Window *window;
// Parse Window Message
OW_Event ParseMessage(struct IntuiMessage *imsg);
};